import { ResPage, User } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

export const SelUserDateport = (params: any) => {
  return http.get<any>("/api/Login/" + PORT1 + "/SelUserDate", params);
};

// 初始化获取名称
export const GetInitializeport = () => {
  return http.get<any>("/api/Login/" + PORT1 + "/GetInitialize");
};

// 登录
export const Loginport = (params: any) => {
  return http.post<any>("/api/Login/" + PORT1 + "/Login", params);
};

// 查询所有的菜单目录
export const GetCaiDanMuLuAllport = () => {
  return http.get<any>("/api/CaiDanRule/" + PORT1 + "/GetCaiDanMuLuAll");
};

// 新增菜单路由
export const PostCaiDanRuleAddport = (params: any) => {
  return http.post<any>("/api/CaiDanRule/" + PORT1 + "/PostCaiDanRuleAdd", params);
};

// 查询全部菜单规则
export const GetCaiDanRuleAllport = () => {
  return http.get<any>("/api/CaiDanRule/" + PORT1 + "/GetCaiDanRuleAll");
};

// 修改菜单规则
export const PostCaiDanRuleUpdateport = (params: any) => {
  return http.put<any>("/api/CaiDanRule/" + PORT1 + "/PutCaiDanRuleUpdate", params);
};

// 删除菜单规则
export const PostCaiDanRuleDeleteport = (params: any) => {
  return http.delete<any>("/api/CaiDanRule/" + PORT1 + "/DeleteCaiDanRuleDelete", params);
};

// 查询角色信息
export const GetSelJueSeAllport = () => {
  return http.get<any>("/api/JueSeUser/" + PORT1 + "/GetSelJueSeAll");
};

// 根据角色ID查询用户
export const GetSelYongHuport = (params: any) => {
  return http.get<any>("/api/JueSeUser/" + PORT1 + "/GetSelYongHu", params);
};

// 查询全部权限
export const GetSelQuanXianport = () => {
  return http.get<any>("/api/JueSeUser/" + PORT1 + "/GetSelQuanXian");
};

// 角色新增
export const PostJueSeAddport = (params: any) => {
  return http.post<any>("/api/JueSeUser/" + PORT1 + "/PostJueSeAdd", params);
};

// 角色编辑
export const PostJueSeUpdateport = (params: any) => {
  return http.put<any>("/api/JueSeUser/" + PORT1 + "/PutJueSeUpdate", params);
};

// 角色删除
export const PostJueSeDeleteport = (params: any) => {
  return http.delete<any>("/api/JueSeUser/" + PORT1 + "/DeleteJueSeDelete", params);
};

// 用户新增
export const PostUserAddport = (params: any) => {
  return http.post<any>("/api/JueSeUser/" + PORT1 + "/PostUserAdd", params);
};

// 用户修改
export const PutUserUpdateport = (params: any) => {
  return http.put<any>("/api/JueSeUser/" + PORT1 + "/PutUserUpdate", params);
};

// 用户删除
export const DeleteUserDeleteport = (data: any) => {
  return http.delete("/api/JueSeUser/" + PORT1 + "/DeleteUserDelete", data);
};

// 用户解锁
export const PutJieChuSuoDingport = (params: any) => {
  return http.put<any>("/api/JueSeUser/" + PORT1 + "/PutJieChuSuoDing", params);
};

// 角色保存权限
export const PostSaveJuSeQuanXianport = (params: any) => {
  return http.post<any>("/api/JueSeUser/" + PORT1 + "/PostSaveJuSeQuanXian", params);
};

// 查询特定用户
export const GetSelUserport = (params: any) => {
  return http.get<any>("/api/JueSeUser/" + PORT1 + "/GetSelUser", params);
};

// 用户批量权限调整
export const PostUserZhuiJiaQuanXianport = (params: any) => {
  return http.post<any>("/api/JueSeUser/" + PORT1 + "/PostUserZhuiJiaQuanXian", params);
};

// 用户角色顺序调整
export const PutUserJueSeTiaoZhengShunXuport = (params: any) => {
  return http.put<any>("/api/JueSeUser/" + PORT1 + "/PutUserJueSeTiaoZhengShunXu", params);
};

// 核心信息查询
export const GetSelHeXinXinXiport = () => {
  return http.get<any>("/api/HeXinXinXi/" + PORT1 + "/GetSelHeXinXinXi");
};

// 查询核心信息参数值
export const GetSelCanShuZhiport = (params: any) => {
  return http.get<any>("/api/HeXinXinXi/" + PORT1 + "/GetSelCanShuZhi", params);
};

// 保存核心信息
export const PostSaveHeXinXinXiport = (params: any) => {
  return http.post<any>("/api/HeXinXinXi/" + PORT1 + "/PostSaveHeXinXinXi", params);
};

// 查询危害因素
export const GetSelWeiHaiYinSuport = (params: any) => {
  return http.get<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/GetSelWeiHaiYinSu", params);
};

// 查询危害因素项目、检查内容、监护依据、国标内容
export const GetSelWeiHaiYinSuDataport = (params: any) => {
  return http.get<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/GetSelWeiHaiYinSuData", params);
};

// 新增危害因素
export const PostWeiHaiYinSuAddport = (params: any) => {
  return http.post<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PostWeiHaiYinSuAdd", params);
};

// 院区查询
export const GetAllYuanQuSelport = () => {
  return http.get<any>("/api/Public/" + PORT1 + "/GetAllYuanQuSel");
};

// 危害因素编辑
export const PutWeiHaiYinSuUpdateport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHaiYinSuUpdate", params);
};

// 危害因素删除
export const DeleteWeiHaiYinSuDeleteport = (params: any) => {
  return http.delete<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/DeleteWeiHaiYinSuDelete", params);
};

// 危害因素组合项目删除
export const DeleteWeiHaiYinSuItemDeleteport = (params: any) => {
  return http.delete<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/DeleteWeiHaiYinSuItemDelete", params);
};

// 危害因素另存为
export const PostWeiHaiYinSuLingCunport = (params: any) => {
  return http.post<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PostWeiHaiYinSuLingCun", params);
};

// 调整危害因素顺序
export const PutWeiHaiYinSunTiaoZhengShunXuport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHaiYinSunTiaoZhengShunXu", params);
};

// 危害因素组合项目修改
export const PutWeiHaiYinSuItemUpdateport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHaiYinSuItemUpdate", params);
};

// 危害因素组合项目调整顺序
export const PutWeiHaiYinSuItemTiaoZhengShunXuport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHaiYinSuItemTiaoZhengShunXu", params);
};

// 危害因素组合项目添加覆盖追加
export const PostWeiHaiYinSuItemAddport = (params: any) => {
  return http.post<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PostWeiHaiYinSuItemAdd", params);
};

// 统一添加组合项目
export const PostWeiHaiYinSuTongYiAddItemport = (params: any) => {
  return http.post<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PostWeiHaiYinSuTongYiAddItem", params);
};

// 危害因素统一更换组合项目
export const PutWeiHuanYinSuTongYiGengHuanItemport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHuanYinSuTongYiGengHuanItem", params);
};

// 危害因素统一删除组合项目
export const DeleteWeiHaiYinSuTongYiDeleteItemport = (params: any) => {
  return http.delete<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/DeleteWeiHaiYinSuTongYiDeleteItem", params);
};
// 查询全部组合项目
export const GetSelItemAllport = () => {
  return http.get<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/GetSelItemAll");
};

// 危害因素监护依据新增
export const PostWeiHaiYinSuJianHuYiJuAddport = (params: any) => {
  return http.post<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PostWeiHaiYinSuJianHuYiJuAdd", params);
};

// 危害因素监护依据调整顺序
export const PutWeiHaiYinSuJianHuYiJuTiaoZhengShunXuport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHaiYinSuJianHuYiJuTiaoZhengShunXu", params);
};

// 危害因素监护依据修改
export const PutWeiHaiYinSuJianHuYiJuUpdateport = (params: any) => {
  return http.put<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PutWeiHaiYinSuJianHuYiJuUpdate", params);
};

// 危害因素监护依据删除
export const DeleteWeiHaiYinSuJianHuYiJuDeleteport = (params: any) => {
  return http.delete<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/DeleteWeiHaiYinSuJianHuYiJuDelete", params);
};

// 查询国标对应组合项目
export const GetSelGuoBiaoDuiYinItemport = (params: any) => {
  return http.get<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/GetSelGuoBiaoDuiYinItem", params);
};

// 国标对应本地组合项目添加
export const PostGuoBiaoDuiYinBenDiItemAddport = (params: any) => {
  return http.post<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/PostGuoBiaoDuiYinBenDiItemAdd", params);
};

// 国标对应组合项目删除
export const DeleteGuoBiaoDuiYinBenDiItemDeleteport = (params: any) => {
  return http.delete<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/DeleteGuoBiaoDuiYinBenDiItemDelete", params);
};

// 分析危害因素
export const GetFenXiWeiHaiYinSuport = (params?: any) => {
  return http.get<any>("/api/WeiHaiYinSuWeiHu/" + PORT1 + "/GetFenXiWeiHaiYinSu", params);
};

// 字典查询
export const GetSelZiDianport = (params?: any) => {
  return http.get<any>("/api/ZiDianWeiHu/" + PORT1 + "/GetSelZiDian", params);
};

// 查询字典明细
export const GetSqlZiDianMingXiport = (params?: any) => {
  return http.get<any>("/api/ZiDianWeiHu/" + PORT1 + "/GetSqlZiDianMingXi", params);
};

// 字典明细删除
export const DeleteZiDianMingXiDeleteport = (params?: any) => {
  return http.delete<any>("/api/ZiDianWeiHu/" + PORT1 + "/DeleteZiDianMingXiDelete", params);
};

// 字典明细新增
export const PostZiDianMingXiAddport = (params?: any) => {
  return http.post<any>("/api/ZiDianWeiHu/" + PORT1 + "/PostZiDianMingXiAdd", params);
};

/**
 * @name 用户管理模块
 */
// 获取用户列表
export const getUserList = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/list`, params);
};

// 获取树形用户列表
export const getUserTreeList = (params: User.ReqUserParams) => {
  return http.post<ResPage<User.ResUserList>>(PORT1 + `/user/tree/list`, params);
};

// 新增用户
export const addUser = (params: { id: string }) => {
  return http.post(PORT1 + `/user/add`, params);
};

// 批量添加用户
export const BatchAddUser = (params: FormData) => {
  return http.post(PORT1 + `/user/import`, params);
};

// 编辑用户
export const editUser = (params: { id: string }) => {
  return http.post(PORT1 + `/user/edit`, params);
};

// 删除用户
export const deleteUser = (params: { id: string[] }) => {
  return http.post(PORT1 + `/user/delete`, params);
};

// 切换用户状态
export const changeUserStatus = (params: { id: string; status: number }) => {
  return http.post(PORT1 + `/user/change`, params);
};

// 重置用户密码
export const resetUserPassWord = (params: { id: string }) => {
  return http.post(PORT1 + `/user/rest_password`, params);
};

// 导出用户数据
export const exportUserInfo = (params: User.ReqUserParams) => {
  return http.download(PORT1 + `/user/export`, params);
};

// 获取用户状态字典
export const getUserStatus = () => {
  return http.get<User.ResStatus[]>(PORT1 + `/user/status`);
};

// 获取用户性别字典
export const getUserGender = () => {
  return http.get<User.ResGender[]>(PORT1 + `/user/gender`);
};

// 获取用户部门列表
export const getUserDepartment = () => {
  return http.get<User.ResDepartment[]>(PORT1 + `/user/department`, {}, { cancel: false });
};

// 获取用户角色字典
export const getUserRole = () => {
  return http.get<User.ResRole[]>(PORT1 + `/user/role`);
};
